package com.itheima.controller;

import com.itheima.pojo.Result;
import com.itheima.service.FileService;
import com.itheima.utils.MyAliYunOssUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;

@RestController
@RequestMapping("/testUpload")
public class FileController {
    @Autowired
    private FileService fileService;

    @PostMapping("upload")
    public Result upload(String name, String age, MultipartFile image){
        System.out.println("name:"+name);
        System.out.println("age:"+age);
        String s=fileService.saveFile(image);
        return Result.success(s);
    }
}
